home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / makefile < prev    next >
Makefile  |  2000-05-19  |  7KB  |  260 lines

  1. # set this to mame, mess or the destination you want to build
  2. TARGET = mame
  3. # TARGET = mess
  4. # TARGET = neomame
  5. # example for a tiny compile
  6. # TARGET = tiny
  7.  
  8. # uncomment next line to include the debugger
  9. # DEBUG = 1
  10.  
  11. # uncomment next line to include the symbols for symify
  12. # SYMBOLS = 1
  13.  
  14. # uncomment next line to use Assembler 68k engine
  15. X86_ASM_68K = 1
  16.  
  17. # set this the operating system you're building for
  18. # (actually you'll probably need your own main makefile anyways)
  19. OS = msdos
  20.  
  21. # extension for executables
  22. EXE = .exe
  23.  
  24. # CPU core include paths
  25. VPATH=src $(wildcard src/cpu/*)
  26.  
  27. # compiler, linker and utilities
  28. AR = @ar
  29. CC = @gcc
  30. LD = gcc
  31. #ASM = @nasm
  32. ASM = @nasmw
  33. ASMFLAGS = -f coff
  34.  
  35. ifdef K6
  36. NAME = $(TARGET)k6
  37. ARCH = -march=k6
  38. else
  39. ifdef I686
  40. NAME = $(TARGET)ppro
  41. ARCH = -march=pentiumpro
  42. else
  43. NAME = $(TARGET)
  44. ARCH = -march=pentium
  45. endif
  46. endif
  47.  
  48. # build the targets in different object dirs, since mess changes
  49. # some structures and thus they can't be linked against each other.
  50. # cleantiny isn't needed anymore, because the tiny build has its
  51. # own object directory too.
  52. OBJ = $(NAME).obj
  53.  
  54. EMULATOR = $(NAME)$(EXE)
  55.  
  56. DEFS = -DX86_ASM -DLSB_FIRST -DINLINE="static __inline__" -Dasm=__asm__
  57.  
  58. ifdef SYMBOLS
  59. CFLAGS = -Isrc -Isrc/msdos -I$(OBJ)/cpu/m68000 -Isrc/cpu/m68000 \
  60.     -O0 -pedantic -Wall -Werror -Wno-unused -g
  61. else
  62. CFLAGS = -Isrc -Isrc/msdos -I$(OBJ)/cpu/m68000 -Isrc/cpu/m68000 \
  63.     -DNDEBUG \
  64.     $(ARCH) -O3 -fomit-frame-pointer -fstrict-aliasing \
  65.     -Werror -Wall -Wno-sign-compare -Wunused \
  66.     -Wpointer-arith -Wbad-function-cast -Wcast-align -Waggregate-return \
  67.     -pedantic \
  68.     -Wshadow \
  69.     -Wstrict-prototypes
  70. #    -W had to remove because of the "missing initializer" warning
  71. #    -Wredundant-decls \
  72. #    -Wlarger-than-27648 \
  73. #    -Wcast-qual \
  74. #    -Wwrite-strings \
  75. #    -Wconversion \
  76. #    -Wmissing-prototypes \
  77. #    -Wmissing-declarations
  78. endif
  79.  
  80. ifdef SYMBOLS
  81. LDFLAGS =
  82. else
  83. #LDFLAGS = -s -Wl,--warn-common
  84. LDFLAGS = -s
  85. endif
  86.  
  87. LIBS = -lalleg -laudio -lz
  88.  
  89. # check that the required libraries are available
  90. ifeq ($(wildcard $(DJDIR)/lib/liballeg.a),)
  91. noallegro:
  92.     @echo Missing Allegro library! Get it from http://www.talula.demon.co.uk/allegro/
  93. endif
  94. ifeq ($(wildcard $(DJDIR)/lib/libaudio.a),)
  95. noseal:
  96.     @echo Missing SEAL library! Get it from http://www.egerter.com/
  97. endif
  98. ifeq ($(wildcard $(DJDIR)/lib/libz.a),)
  99. nozlib:
  100.     @echo Missing zlib library! Get it from http://www.cdrom.com/pub/infozip/zlib/
  101. endif
  102.  
  103. #if obj subdirectory doesn't exist, create the tree before proceeding
  104. ifeq ($(wildcard $(OBJ)),)
  105. noobj: maketree all
  106. endif
  107.  
  108. all:    $(EMULATOR) extra
  109.  
  110. # include the various .mak files
  111. include src/core.mak
  112. include src/$(TARGET).mak
  113. include src/rules.mak
  114. include src/$(OS)/$(OS).mak
  115.  
  116. ifdef DEBUG
  117. DBGDEFS = -DMAME_DEBUG
  118. else
  119. DBGDEFS =
  120. DBGOBJS =
  121. endif
  122.  
  123. extra:    romcmp$(EXE) $(TOOLS) $(TEXTS)
  124.  
  125. # combine the various definitions to one
  126. CDEFS = $(DEFS) $(COREDEFS) $(CPUDEFS) $(SOUNDDEFS) $(ASMDEFS) $(DBGDEFS)
  127.  
  128. $(EMULATOR): $(OBJS) $(COREOBJS) $(OSOBJS) $(LIBS) $(DRVLIBS)
  129. # always recompile the version string
  130.     $(CC) $(CDEFS) $(CFLAGS) -c src/version.c -o $(OBJ)/version.o
  131.     @echo Linking $@...
  132.     $(LD) $(LDFLAGS) $(OBJS) $(COREOBJS) $(OSOBJS) $(LIBS) $(DRVLIBS) -o $@
  133. ifndef DEBUG
  134.     upx $(EMULATOR)
  135. endif
  136.  
  137. romcmp$(EXE): $(OBJ)/romcmp.o $(OBJ)/unzip.o
  138.     @echo Linking $@...
  139.     $(LD) $(LDFLAGS) $^ -lz -o $@
  140.  
  141. $(OBJ)/%.o: src/%.c
  142.     @echo Compiling $<...
  143.     $(CC) $(CDEFS) $(CFLAGS) -c $< -o $@
  144.  
  145. # compile generated C files for the 68000 emulator
  146. $(M68000_GENERATED_OBJS): $(OBJ)/cpu/m68000/m68kmake$(EXE)
  147.     @echo Compiling $(subst .o,.c,$@)...
  148.     $(CC) $(CDEFS) $(CFLAGS) -c $*.c -o $@
  149.  
  150. # additional rule, because m68kcpu.c includes the generated m68kops.h :-/
  151. $(OBJ)/cpu/m68000/m68kcpu.o: $(OBJ)/cpu/m68000/m68kmake$(EXE)
  152.  
  153. # generate C source files for the 68000 emulator
  154. $(OBJ)/cpu/m68000/m68kmake$(EXE): src/cpu/m68000/m68kmake.c
  155.     @echo M68K make $<...
  156.     $(CC) $(CDEFS) $(CFLAGS) -DDOS -o $(OBJ)/cpu/m68000/m68kmake$(EXE) $<
  157.     @echo Generating M68K source files...
  158.     $(OBJ)/cpu/m68000/m68kmake $(OBJ)/cpu/m68000 src/cpu/m68000/m68k_in.c
  159.  
  160. # generate asm source files for the 68000 emulator
  161. $(OBJ)/cpu/m68000/68kem.asm:  src/cpu/m68000/make68k.c
  162.     @echo Compiling $<...
  163.     $(CC) $(CDEFS) $(CFLAGS) -O0 -DDOS -o $(OBJ)/cpu/m68000/make68k$(EXE) $<
  164.     @echo Generating $@...
  165.     @$(OBJ)/cpu/m68000/make68k$(EXE) $@ $(OBJ)/cpu/m68000/comptab.asm
  166.  
  167. # generated asm files for the 68000 emulator
  168. $(OBJ)/cpu/m68000/68kem.o:  $(OBJ)/cpu/m68000/68kem.asm
  169.     @echo Assembling $<...
  170.     $(ASM) -o $@ $(ASMFLAGS) $(subst -D,-d,$(ASMDEFS)) $<
  171.  
  172. $(OBJ)/%.a:
  173.     @echo Archiving $@...
  174.     $(AR) cr $@ $^
  175.  
  176. makedir:
  177.     @echo make makedir is no longer necessary, just type make
  178.  
  179. maketree:
  180.     @echo Making MAME object tree in $(OBJ)...
  181.     @md $(OBJ)
  182.     @md $(OBJ)\cpu
  183.     @md $(OBJ)\cpu\z80
  184.     @md $(OBJ)\cpu\z80gb
  185.     @md $(OBJ)\cpu\m6502
  186.     @md $(OBJ)\cpu\h6280
  187.     @md $(OBJ)\cpu\i86
  188.     @md $(OBJ)\cpu\nec
  189.     @md $(OBJ)\cpu\i8039
  190.     @md $(OBJ)\cpu\i8085
  191.     @md $(OBJ)\cpu\m6800
  192.     @md $(OBJ)\cpu\m6805
  193.     @md $(OBJ)\cpu\m6809
  194.     @md $(OBJ)\cpu\konami
  195.     @md $(OBJ)\cpu\m68000
  196.     @md $(OBJ)\cpu\s2650
  197.     @md $(OBJ)\cpu\t11
  198.     @md $(OBJ)\cpu\tms34010
  199.     @md $(OBJ)\cpu\tms9900
  200.     @md $(OBJ)\cpu\z8000
  201.     @md $(OBJ)\cpu\tms32010
  202.     @md $(OBJ)\cpu\ccpu
  203.     @md $(OBJ)\cpu\adsp2100
  204.     @md $(OBJ)\cpu\pdp1
  205.     @md $(OBJ)\cpu\mips
  206.     @md $(OBJ)\sound
  207.     @md $(OBJ)\msdos
  208.     @md $(OBJ)\drivers
  209.     @md $(OBJ)\machine
  210.     @md $(OBJ)\vidhrdw
  211.     @md $(OBJ)\sndhrdw
  212. ifdef MESS
  213.     @echo Making MESS object tree in $(OBJ)\mess...
  214.     @md $(OBJ)\mess
  215.     @md $(OBJ)\mess\systems
  216.     @md $(OBJ)\mess\machine
  217.     @md $(OBJ)\mess\vidhrdw
  218.     @md $(OBJ)\mess\sndhrdw
  219.     @md $(OBJ)\mess\tools
  220.     @md $(OBJ)\mess\tools\dat2html
  221.     @md $(OBJ)\mess\tools\mkhdimg
  222.     @md $(OBJ)\mess\tools\imgtool
  223. endif
  224.  
  225. clean:
  226.     @echo Deleting object tree $(OBJ)...
  227.     deltree /Y $(OBJ)
  228.     @echo Deleting $(EMULATOR)...
  229.     @del $(EMULATOR)
  230.  
  231. cleandebug:
  232.     @echo Deleting debug obj tree...
  233.     @del $(OBJ)\*.o
  234.     @del $(OBJ)\cpu\z80\*.o
  235.     @del $(OBJ)\cpu\z80gb\*.o
  236.     @del $(OBJ)\cpu\m6502\*.o
  237.     @del $(OBJ)\cpu\h6280\*.o
  238.     @del $(OBJ)\cpu\i86\*.o
  239.     @del $(OBJ)\cpu\nec\*.o
  240.     @del $(OBJ)\cpu\i8039\*.o
  241.     @del $(OBJ)\cpu\i8085\*.o
  242.     @del $(OBJ)\cpu\m6800\*.o
  243.     @del $(OBJ)\cpu\m6805\*.o
  244.     @del $(OBJ)\cpu\m6809\*.o
  245.     @del $(OBJ)\cpu\konami\*.o
  246.     @del $(OBJ)\cpu\m68000\*.o
  247.     @del $(OBJ)\cpu\m68000\*.c
  248.     @del $(OBJ)\cpu\s2650\*.o
  249.     @del $(OBJ)\cpu\t11\*.o
  250.     @del $(OBJ)\cpu\tms34010\*.o
  251.     @del $(OBJ)\cpu\tms9900\*.o
  252.     @del $(OBJ)\cpu\z8000\*.o
  253.     @del $(OBJ)\cpu\tms32010\*.o
  254.     @del $(OBJ)\cpu\ccpu\*.o
  255.     @del $(OBJ)\cpu\adsp2100\*.o
  256.     @del $(OBJ)\cpu\pdp1\*.o
  257.     @del $(OBJ)\cpu\mips\*.o
  258.     @del $(EMULATOR)
  259.  
  260.